<%@ page import="com.itheima.pojo.Address" %>
<%@ page import="com.itheima.pojo.User" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %><%--
  Created by IntelliJ IDEA.
  User: Yoyo-ba
  Date: 2021/10/31
  Time: 14:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    //创建一个Address对象 存到域中
    Address address = new Address();
    address.setArea("昌平区");
    address.setCity("北京");
    //创建一个User user
    User user = new User();
    user.setName("jack");
    user.setAge(18);
    user.setAddr(address);

    //存储数组
    String[] arr = {"马子龙","马子睿","马子虎"};
    request.setAttribute("sanxiongdi",arr);

    ArrayList<Address> list = new ArrayList<>();

    list.add(address);
    Address address2 = new Address();
    address2.setArea("红灯区");
    address2.setCity("东莞");
    list.add(address2);
    //存了一个集合
    request.setAttribute("list",list);

    Map<String,String> map = new HashMap<>();
    map.put("jack","rose");
    map.put("tom","jerry");
    map.put("romiou","zhuliye");

    request.setAttribute("map",map);
%>
   <%--从域中把 数组中的第一个元素取出来--%>
   数组中第一个元素:${sanxiongdi[0]}
   <br/>
   集合中第二个元素的区域:${list.get(1).area}
   <br/>
   map集合中jack的配偶:${map.get("jack")}
  ${map.jack}


</body>
</html>
